{layout name="public/layout" /}
{include file='yxnavbar'}


<div class="main">
    {include file='../../plugin/redrain/template/web/common_nav'}
    {if $method == "chance_data"}
    <div class="panel panel-info">
        <div class="panel-heading">当前数量： {$total}</div>
        <div class="panel-body">
            <form id="myform" action="./index.php" method="get" class="form-horizontal" role="form">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="{$_P['m']}" />
                <input type="hidden" name="do" value="web" />
                <input type="hidden" name="r" value="redrain.chance.userdata" id="r" />
                <input type="hidden" name="type" value="{$type}" />
                <div class="form-group">
                    <label class="col-xs-1 col-sm-1 col-md-1 control-label">机会数据</label>
                    <div class="col-xs-11 col-sm-9 col-md-9">
                        <div class="btn-group">
                             <a href="#" class="btn btn-default">
                                   粉丝
                                  <span style="color: #ff0000">{$total_data['cnt']}</span>
                             </a>
                            <a href="#" class="btn btn-default">
                                总机会
                                <span style="color: #ff0000">{$total_data['all_chanece']}</span>
                            </a>
                            <a href="#" class="btn btn-default">
                                已使用
                                <span style="color: #ff0000">{$total_data['all_used_chance']}</span>
                            </a>
                            <a href="#" class="btn btn-default">
                                未使用
                                <span style="color: #ff0000">{$total_data['all_remaining_chance']}</span>
                            </a>
                        </div>
                    </div>
                    {if count($themelist)>1 }
                    <div class="col-xs-12 col-sm-2 col-md-2">
                        <select onchange="submitForm();" class="form-control" name="themeid">
                            {loop $themelist $row}
                            <option value="{$row['id']}" {if $themeid == $row['id'] }selected="selected"{/if}>{$row['id']} - {php echo mb_substr($row['title'],0,8,'utf-8');}</option>
                            {/loop}
                        </select>
                    </div>
                    {else}
                    <input type="hidden" name="themeid" value="{$themeid}" />
                    {/if}
                </div>

                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-1 control-label">更新时间</label>
                    <div class="col-sm-3 col-lg-3 col-md-3 col-xs-6">
                        <!--                        {php echo view_form_field_daterange('createtime', array('start' => $start_day, 'end' => $end_day));}-->
                        {php echo view_form_field_daterange('createtime', array('start'=>date('Y-m-d H:i:s',$starttime),'end'=>date('Y-m-d H:i:s',$endtime)), true);}
                    </div>

                </div>
                <div class="form-group clearfix">
                    <label class="col-xs-12 col-sm-3 col-md-1 control-label">关键字</label>
                    <div class="col-sm-4 col-xs-4 col-md-4">
                        <input class="form-control" name="search_data" placeholder="输入报名手机号、微信昵称、客资姓名" type="text" value="{$_P['search_data']}">
                    </div>
                    <div class="col-sm-3 col-lg-3 col-md-3 col-xs-6">
                        <button class="btn btn-primary"><i class="fa fa-search"></i> 搜索</button>
                        <input type="hidden" name="__token__" value="{$Request.token}"/>
                    </div>
                    <div class="col-sm-2 col-lg-2 col-md-2 col-xs-2">
                        <input class="btn btn-default" type="submit" name="export_submit" onclick="jump()" id="export_submit" value="导出EXCEL">
                    </div>
                </div>
            </form>
        </div>
     </div>
    {/if}

    <div class="tab-content">
        <div class="panel panel-default">
            <div class="panel-body table-responsive">
                <table class="table table-hover">
                    <thead class="navbar-inner">
                    <tr>
                        <th style="width: 60px">用户id</th>
                        <th style="width: 100px">昵称</th>
                        <th style="width: 100px">姓名/电话</th>
                        <th style="width: 100px">总机会</th>
                        <th style="width: 100px">已使用</th>
                        <th style="width: 100px">未使用</th>
                        <th style="width: 160px;text-align: right">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {loop $list $index $item}
                    <tr>
                        <td>{$item['uid']}</td>
                        <td>
                            <img src="{php echo tomedia($item['avatar']);}" style="width: 28px;height: 28px;padding: 1px;">
                            <br>
                            {$item['nickname']}
                        </td>
                        <td>{$item['username']}<br/>{$item['mobile']}</td>
                        <td> <span class="label label-success">{$item['all_chanece']}</span></td>
                        <td> <span class="label label-warning">{$item['all_used_chance']}</span></td>
                        <td><span class="label label-info">{$item['all_remaining_chance']}</span></td>
                        <td style="text-align: right">
                            <a href="{php echo createWebUrlPlugin('redrain.chance.main',array('themeid'=>$themeid,'uid'=>$item['uid']));}" class="btn btn-default">
                                机会
                            </a>
                            <a href="{php echo createWebUrlPlugin('redrain.flag.main',array('themeid'=>$themeid,'uid'=>$item['uid']));}" class="btn btn-default">
                                红包
                            </a>
                        </td>
                    </tr>
                    {/loop}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

{$pager}
<script type="text/javascript">
    $(document).ready(
        function (){

        }
    );
    function jump(){
        layer.msg('正在准备下载');
    }
    function submitForm(){
        $("#r").val('redrain.chance.userdata');
        var form = document.getElementById("myform");
        form.submit();
    }
</script>
